var ajaxHelper = require("../../utils/ajaxhelp");
const serviceUrl = getApp().globalData.serviceUrl;
let token = wx.getStorageSync('token');

const GetScreenItemData = (hospitalId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenItem/Get", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		hospitalId: hospitalId
	})
}

const GetScreenAllTeams = () => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenItem/GetScreenAllTeams", {
		'Authorization': 'Bearer ' + token
	}, "GET", null)
}
const GetAllHospital = () => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Hospital/Get", {
		'Authorization': 'Bearer ' + token
	}, "GET", null)
}
const GetDepartmentsByHospID = (hospitalId) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Department/GetDepartmentsByHospID", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		hospitalId: hospitalId,
		name: ''
	})
}
const CreateSQSC = (obj = {}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Screen/CreateSQSC", {
		'Authorization': 'Bearer ' + token
	}, "POST", obj)
}
const UpdateSQSC = (obj = {}) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/Screen/UpdateSQSCGroup", {
		'Authorization': 'Bearer ' + token
	}, "POST", obj)
}
const GetScreenPropagandaByScidAndLeadId = (scid, leadid) => {
	token = wx.getStorageSync('token');
	return ajaxHelper.promiseRequst(serviceUrl + "/api/ScreenPropaganda/QueryPropagandaByScidAndLeadId", {
		'Authorization': 'Bearer ' + token
	}, "GET", {
		scid: scid,
		leadid: leadid
	})
}

module.exports = {
	GetScreenItemData,
	GetScreenAllTeams,
	GetAllHospital,
	GetDepartmentsByHospID,
	CreateSQSC,
	UpdateSQSC,
	GetScreenPropagandaByScidAndLeadId
}
